<!--
	Carnegie Mellon University
	School of Computer Science
	MSIT eBusiness Technology

	Team 8 - Infinity (2011 Spring)
	infinity-team8@googlegroups.com

	Professor: Jeffrey L. Eppinger
	Program Faculty: Sujata Telang
-->

<jsp:include page="employee-template-top.jsp" />
<jsp:include page="employee-topnav.jsp" />
<%@ page import="databean.FundPriceHistoryBean" %>
<%@ page import="databean.FundBean" %>
<%@ page import="model.FundDAO" %>
<%@ page import="model.FundPriceHistoryDAO" %>
<div id="header">
	<h1>Fund Price History</h1>
</div>

<jsp:include page="employee-sidebar.jsp" />
<div id="content">


<table id="minimal" summary="display fund price history">

	<tr>
		<th>Symbol</th>
		<th>Price Date</th>
		<th>Price</th>
	</tr>


<%
	FundPriceHistoryBean[] beans = (FundPriceHistoryBean[]) request.getAttribute("fundPriceList");
	String previous = "";
	String symbol = "";

	for (FundPriceHistoryBean bean : beans) {
	
	FundDAO fundDAO  = new FundDAO();
	FundPriceHistoryDAO fundPriceHistoryDAO = new FundPriceHistoryDAO();
	FundBean fund = fundDAO.lookup(bean.getFundID());
	
	if (previous.equals(fund.getSymbol())) {
		symbol = "";
	} else {
		symbol = fund.getSymbol();
		previous = fund.getSymbol();
	}
	
%>


<tr>
	<td><%=symbol%></td>
	<td><%=bean.getPriceDate()%></td>
	<td>&#36; <%=fundPriceHistoryDAO.getPriceFormatted(bean.getFundID(), bean.getPriceDate())%></td>
</tr>

<%
	}
%>

</table>
</div>
<jsp:include page="footer.jsp" />
